home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue45 / Clinic / ClientFormU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-11-02  |  905 b   |  46 lines

  1. unit ClientFormU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Server_Stub, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Timer1: TTimer;
  12.     Label1: TLabel;
  13.     procedure FormCreate(Sender: TObject);
  14.     procedure Timer1Timer(Sender: TObject);
  15.   public
  16.     Server: ITest;
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21.  
  22. implementation
  23.  
  24. {$R *.DFM}
  25.  
  26. procedure TForm1.FormCreate(Sender: TObject);
  27. begin
  28.   Server := TTestCorbaFactory.CreateInstance('');
  29.   Timer1.Enabled := True
  30. end;
  31.  
  32. procedure TForm1.Timer1Timer(Sender: TObject);
  33. begin
  34.   try
  35.     Label1.Caption := DateTimeToStr(Server.Get_DateAndTime)
  36.   except
  37.     on E: Exception do
  38.     begin
  39.       Timer1.Enabled := False;
  40.       Label1.Caption := Format('Server not available (an %s exception occurred, saying "%s")', [E.ClassName, E.Message])
  41.     end
  42.   end
  43. end;
  44.  
  45. end.
  46.